package com.rede.didiok.user.modulelist.rank.restapi;

import java.util.Arrays;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.rede.didiok.common.dto.rank.MemberTagDto;
import com.rede.didiok.common.utils.R;
import com.rede.didiok.common.utils.ResultUtil;
import com.rede.didiok.user.modulelist.rank.entity.MemberTagEntity;
import com.rede.didiok.user.modulelist.rank.service.MemberTagService;


/**
 * 榜单成员标签
 *
 * @author Rede
 * @email didiok@foxmail.com
 * @date 2023-07-20 22:09:24
 */
@RestController
@RequestMapping("memberTag")
public class MemberTagRestApi {
    @Autowired
    private MemberTagService memberTagService;

    /**
     * 列表
     */
    @GetMapping("/list")
    // @RequiresPermissions("rank:tag:list")
    public String list(MemberTagDto memberTagDto){
        return ResultUtil.successWithData(memberTagService.getPageList(memberTagDto));

    }


    /**
     * 信息
     */
    @GetMapping("/info/{uid}")
    // @RequiresPermissions("rank:tag:info")
    public String info(@PathVariable("uid") String uid){
        return ResultUtil.successWithData(memberTagService.getById(uid));
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("rank:tag:save")
    public R save(@RequestBody MemberTagEntity tag){
		memberTagService.save(tag);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("rank:tag:update")
    public R update(@RequestBody MemberTagEntity tag){
		memberTagService.updateById(tag);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("rank:tag:delete")
    public R delete(@RequestBody Long[] tagIds){
		memberTagService.removeByIds(Arrays.asList(tagIds));

        return R.ok();
    }

}
